GIT Interview Questions

Ratings:
(4)
Views: 0
Banner-Img
Share this blog:

 

GIT Interview Questions

Q1. Define GIT?

Git is a Distributed Version Control system (DVCS). It can track changes to a file and allows you to revert back to any particular change.

Q2. Define ‘bare repository’ in Git?

A “bare” repository in Git it doesn’t contain the special .git sub-directory, just contains the version control information and no working files (no tree). Instead, it contains all the contents of the git sub-directory directly in the main directory itself, where as working directory consist of:  

  • A working tree, or checked out copies of your project files.
  • A .git subdirectory with all the Git related revision history of your repo.
If you want to enrich your career and become a professional in GIT Developer,
then visit Tekslate -a global online training platform: "GIT Training"
This course will help you to achieve excellence in this domain.

Q3. What are the different ways you can refer to a commit?

In Git each commit is given a unique hash. These hashes can be used to identify the corresponding commits in various scenarios (such as while trying to checkout a particular state of the code using the git checkout {hash} command).

Additionally, Git also maintains a number of aliases to certain commits, known as refs. Also, every tag that you create in the repository effectively becomes a ref (and that is exactly why you can use tags instead of commit hashes in various git commands). Git also maintains a number of special aliases that change based on the state of the repository, such as HEAD, FETCH_HEAD, MERGE_HEAD, etc.

Git also allows commits to be referred as relative to one another. For example, HEAD~1 refers to the commit parent to HEAD, HEAD~2 refers to the grandparent of HEAD, and so on. In case of merge commits, where the commit has two parents, ^ can be used to select one of the two parents, e.g. HEAD^2 can be used to follow the second parent.

And finally, refspecs. These are used to map local and remote branches together. However, these can be used to refer to commits that reside on remote branches allowing one to control and manipulate them from a local Git environment.

Q4. What is a conflict in git and how can it be resolved?

A conflict arises when more than one commit that has to be merged has some change in the same place or same line of code. Git will not be able to predict which change should take precedence. This is a git conflict.

To resolve the conflict in git, edit the files to fix the conflicting changes and then add the resolved files by running git add. After that, to commit the repaired merge, run git commit. Git remembers that you are in the middle of a merge, so it sets the parents of the commit correctly.

Q5. What does the commit object contain?

Commit object contains the following components, you should mention all the three points present below:

A set of files, representing the state of a project at a given point of time

Reference to parent commit objects

An SHAI name, a 40 character string that uniquely identifies the commit object.

Q6. What is SubGit?

SubGit is a tool for SVN to Git migration. It creates a writable Git mirror of a local or remote Subversion repository and uses both Subversion and Git as long as you like.

Q7. What is the HEAD in GIT ?

AHEAD is a reference to the present looked at conferring.

It is a representative referred to the branch that we have looked at.

At any given time, one head is chosen as the ‘present head’ this head is otherwise called HEAD (dependably in capitalized).

Q8. What are Git Design objectives?

Distributed workflow (decentralized)

Easy merging (merge deemed more frequent than commit)

Integrity (protection against accidental/malicious corruptions)

Speed & scalability

Q9. What is Version Control with Git?

Version control is better than mailing files back and forth because:

  • It’s is not impossible to coincidentally overwrite or overlook someone’s changes: whenever there’s a conflict between one person’s work and another’s, the version control system automatically notifies users.
  • If people are having some questions to ask, they will maintain the records what changes they have made.
  • Nothing that is committed to version control is ever lost. it’s always possible to go back in time to know exactly who wrote what on a particular day, or what version of a program was used to generate a particular set of results. This means it can be used like the undo feature in an editor, and since all previous versions of files are saved.

Git is one of many version control systems. It is more complex than some alternatives, but it is widely used, both because it’s easy to set up and because of a hosting site called GitHub, which we will get to later.

Q10. What are the main benefits of GIT ?

Distributed System: GIT is a Distributed Version Control System (DVCS). So you can keep your private work in adaptation control yet totally escaped others. You can work disconnected too.

⦁ Flexible Workflow:GIT enables you to make your own work process. You can utilize the procedure that is appropriate for your venture. You can go for brought together or ace slave or some other work process.

⦁ Fast: GIT is quick when contrasted with other form control frameworks.

⦁ Data Integrity: Since GIT utilizes SHA1, information isn’t less demanding to degenerate.

⦁ Free: It is free for individual utilize. Such huge numbers of beginners utilize it for their underlying activities. It likewise works exceptionally well with substantial size task.

⦁ Collaboration: GIT is anything but difficult to use for ventures in which joint effort is required. Numerous prevalent open source programming over the globe utilize GIT

 

You liked the article?

Like: 0

Vote for difficulty

Current difficulty (Avg): Medium

EasyMediumHardDifficultExpert
IMPROVE ARTICLEReport Issue

About Author

Authorlogo
Name
TekSlate
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.

Stay Updated
Get stories of change makers and innovators from the startup ecosystem in your inbox